package com.example.mybatis.handler.result;

import com.example.mybatis.config.Config;
import com.example.mybatis.mapper.MapperResultItemTemplate;

import java.sql.ResultSet;
import java.util.List;

public class ResultHandlerContext {
    /**
     * 结果类型
     * @since 0.0.12
     */
    private Class<?> resultType;

    /**
     * 配置信息
     * @since 0.0.12
     */
    private Config config;

    /**
     * 结果映射标识
     * @since 0.0.12
     */
    private String resultMapId;

    /**
     * 结果映射信息信息
     * @since 0.0.12
     */
    private List<MapperResultItemTemplate> resultMapMapping;

    /**
     * 结果集
     * @since 0.0.12
     */
    private ResultSet resultSet;



    /**
     * 创建实例对象
     * @return
     */
    public static ResultHandlerContext newInstance(){
        return new ResultHandlerContext();
    }

    public Class<?> resultType(){
        return  resultType;
    }

    public Config  config() {
        return config;
    }

    public ResultHandlerContext   resultType(Class<?> resultType) {
        this.resultType = resultType;
        return  this;
    }

    public ResultHandlerContext config(Config config) {
        this.config = config;
        return this;
    }

    public List<MapperResultItemTemplate> resultMapMapping() {
        return resultMapMapping;
    }

    public ResultHandlerContext resultMapMapping(List<MapperResultItemTemplate> resultMapMapping) {
        this.resultMapMapping = resultMapMapping;
        return this;
    }

    public ResultSet resultSet() {
        return resultSet;
    }

    public ResultHandlerContext resultSet(ResultSet resultSet) {
        this.resultSet = resultSet;
        return this;
    }

    public String resultMapId() {
        return resultMapId;
    }

    public ResultHandlerContext resultMapId(String resultMapId) {
        this.resultMapId = resultMapId;
        return this;
    }


}
